﻿using IMES.Common.Domain.DariusModel;
using IMES.Common.Dtos;
using IMES.Common.Infrastructure;
using MediatR;

namespace Darius.API.Application.Commands.Order
{
    public class OrderProductSearchHandler : IRequestHandler<OrderProductSearchCommand, Result>
    {
        private readonly IBaseRepositorys<SaleOrders> saleorderRepository;

        public OrderProductSearchHandler(IBaseRepositorys<SaleOrders> saleorderRepository)
        {
            this.saleorderRepository = saleorderRepository;
        }

        public async Task<Result> Handle(OrderProductSearchCommand request, CancellationToken cancellationToken)
        {
            var result= new Result() { Code=(int)CodeEnum.search};
            var list=saleorderRepository.GetAll().Where(x=>x.OrderId==request.OrderId).FirstOrDefault();
            result.Data = list;
            result.Messege="订单查询成功";
            return result;
        }
    }
}
